﻿$("#btnJoin").click(function () {
    AddClickCount('dmyy','地面会场预约按钮','')
    var username = $('#spanuname').html();
    var mobile = $('#txt_mobile').val();
    var mobileReg = /^1[3,4,5,8][0-9]{9}$/;
    if (mobile != "" && mobile != "请输入手机号码以获得预约号") {
        if (!mobileReg.test(mobile) && mobile != '') {
            alert("请输入手机号码以获得预约号！");
            return false;
        }
    }
    else {
        alert("请输入手机号码以获得预约号！");
        $('#txt_mobile').focus();
        return false;
    }
    var _area = $("#spanarea").html();
    var _id = $("#placeid").html();
    mobile = encodeURIComponent(do_encrypt(mobile));

    $.getJSON("http://mini.emoney.cn/jrpt/Payyxb/submitUser?ac=submitnew&area=" + _area + "&username=" + username + "&mobile=" + mobile + "&id=" + _id + "&type=0" + "&callback=?", function (data) {
        if (data.result == "预约成功！") {
            $.post(www + "Train/GetReservenum_dm", { placenum: $("#placenum").html() }, function (data) {
                $("#spanyyCode").html(data);//预约码
                $("#spanPname").html($("#pname").html());
                $("#spanAddr").html($("#paddr").html());
                opentips("OrderSucDiv_dm");
            });
        }
        else {
            alert(data.result);
            location.reload();
        }
    });
});